/*
 #
 #  Files       : MiscTemplate.h
 #                ( C++ header file )
 #
 #  Description : The SmallMatrix Library
 #                ( http://code.google.com/p/smallmatrix )
 #
 #  Copyright   : Olivier Juan
 #                ( http://www.mas.ecp.fr/vision/Personnel/juan/ )
 #
 #  License     : CeCILL-C
 #                ( http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html )
 #
 #  This software is governed by the CeCILL-C license under French law and
 #  abiding by the rules of distribution of free software.  You can  use,
 #  modify and or redistribute the software under the terms of the CeCILL-C
 #  license as circulated by CEA, CNRS and INRIA at the following URL
 #  "http://www.cecill.info".
 #
 #  As a counterpart to the access to the source code and  rights to copy,
 #  modify and redistribute granted by the license, users are provided only
 #  with a limited warranty  and the software's author,  the holder of the
 #  economic rights,  and the successive licensors  have only  limited
 #  liability.
 #
 #  In this respect, the user's attention is drawn to the risks associated
 #  with loading,  using,  modifying and/or developing or reproducing the
 #  software by the user in light of its specific status of free software,
 #  that may mean  that it is complicated to manipulate,  and  that  also
 #  therefore means  that it is reserved for developers  and  experienced
 #  professionals having in-depth computer knowledge. Users are therefore
 #  encouraged to load and test the software's suitability as regards their
 #  requirements in conditions enabling the security of their systems and/or
 #  data to be ensured and,  more generally, to use and operate it in the
 #  same conditions as regards security.
 #
 #  The fact that you are presently reading this means that you have had
 #  knowledge of the CeCILL-C license and that you accept its terms.
 #
*/

#ifndef _MISC_TEMPLATE_H
#define _MISC_TEMPLATE_H

#include <SmallMatrix/SmallMatrix.h>

NAMESPACE_BEGIN(SmallMatrix)

struct IndexListEnd {
	enum { ObtainRow = true, ObtainCol = false };
	enum { Number = 0 };
	template <bool Dim,int Size, int N>
	struct Give {
		enum { Value = N };
	};
	template <bool Dim,int Size, int N>
	struct Index {
		enum { Value = Give<Dim,Size,N>::Value };
	};
};
template <int _Row,int _Col, class _Next = IndexListEnd>
struct IndexList {
	enum { ObtainRow = true, ObtainCol = false };
	enum { Number = _Next::Number + 1 };
	template <bool Dim,int Size, int N = 0>
	struct Give {
		enum { Others = _Next::template Give<Dim,Size,N>::Value };
		template <bool B TPS_START_GCC(0)>
		struct Agree {
			enum { NextOthers = (Others + 1)%Size };
			enum { _Value = _Next::template Give<Dim,Size,NextOthers>::Value };
		};
		template < TPS_END_GCC(0) >
		struct Agree< false TPS_GCC(0)> {
			enum { _Value = Others };
		};
		enum { Test = Dim ? _Row : _Col };
		enum { Bool = (Test == Others) };
		enum { Value = Agree<Bool>::_Value };
	};
	template <bool Dim,int Size, int N>
	struct Index {
		enum { Previous = Index<Dim,Size,N-1>::Value };
		enum { NextValue = (Previous + 1)%Size };
		enum { Value = Give<Dim,Size,NextValue>::Value };
	};
	template <bool Dim,int Size>
	struct Index<Dim,Size,0> {
		enum { Value = Give<Dim,Size,0>::Value };
	};
};
template <class IndexL, int R, int C, int Dim>
struct det_Unrolled{
	template <int Size>
		static INLINE reel compute(const SquareMatrix<Size>& Mat){
			enum { IdxCol = Dim - C };
			enum { IdxRow = Dim - R };
			enum { Row = IndexL::template Index<IndexL::ObtainRow,Size,IdxRow>::Value };
			enum { Col = IndexL::template Index<IndexL::ObtainCol,Size,IdxCol>::Value };
			enum { Sign = (((IdxCol+IdxRow) % 2) == 0) ? 1 : -1 };
			typedef IndexList<Row,Col,IndexL> NextIdx;
			return Sign*Mat.template Access<Row,Col>()*det_Unrolled<NextIdx,Dim-1,Dim-1,Dim-1>::compute(Mat)
				+det_Unrolled<IndexL,R,C-1,Dim>::compute(Mat);
		}
	template <int Size>
		static INLINE reel compute(const SymMatrix<Size>& Mat){
			enum { IdxCol = Dim - C };
			enum { IdxRow = Dim - R };
			enum { Row = IndexL::template Index<IndexL::ObtainRow,Size,IdxCol>::Value };
			enum { Col = IndexL::template Index<IndexL::ObtainCol,Size,IdxRow>::Value };
			enum { Sign = (((IdxCol+IdxRow) % 2) == 0) ? 1 : -1 };
			typedef IndexList<Row,Col,IndexL> NextIdx;
			return Sign*Mat.template Access<Row,Col>()*det_Unrolled<NextIdx,Dim-1,Dim-1,Dim-1>::compute(Mat)
				+det_Unrolled<IndexL,R,C-1,Dim>::compute(Mat);
		}
};
template <class IndexL, int R, int Dim>
struct det_Unrolled<IndexL,R,1,Dim>{
	template <int Size>
		static INLINE reel compute(const SquareMatrix<Size>& Mat){
			enum { IdxCol = Dim - 1 };
			enum { IdxRow = Dim - R };
			enum { Row = IndexL::template Index<IndexL::ObtainRow,Size,IdxRow>::Value };
			enum { Col = IndexL::template Index<IndexL::ObtainCol,Size,IdxCol>::Value };
			enum { Sign = (((IdxCol+IdxRow) % 2) == 0) ? 1 : -1 };
			typedef IndexList<Row,Col,IndexL> NextIdx;
			return Sign*Mat.template Access<Row,Col>()*det_Unrolled<NextIdx,Dim-1,Dim-1,Dim-1>::compute(Mat);
		}
	template <int Size>
		static INLINE reel compute(const SymMatrix<Size>& Mat){
			enum { IdxCol = Dim - 1 };
			enum { IdxRow = Dim - R };
			enum { Row = IndexL::template Index<IndexL::ObtainRow,Size,IdxCol>::Value };
			enum { Col = IndexL::template Index<IndexL::ObtainCol,Size,IdxRow>::Value };
			enum { Sign = (((IdxCol+IdxRow) % 2) == 0) ? 1 : -1 };
			typedef IndexList<Row,Col,IndexL> NextIdx;
			return Sign*Mat.template Access<Row,Col>()*det_Unrolled<NextIdx,Dim-1,Dim-1,Dim-1>::compute(Mat);
		}
};
template <class IndexL>
struct det_Unrolled<IndexL,1,1,1>{
	template <int Size>
		static INLINE reel compute(const SquareMatrix<Size>& Mat){
			enum { Row = IndexL::template Index<IndexL::ObtainRow,Size,0>::Value };
			enum { Col = IndexL::template Index<IndexL::ObtainCol,Size,0>::Value };
			return Mat.template Access<Row,Col>();
		}
	template <int Size>
		static INLINE reel compute(const SymMatrix<Size>& Mat){
			enum { Row = IndexL::template Index<IndexL::ObtainRow,Size,0>::Value };
			enum { Col = IndexL::template Index<IndexL::ObtainCol,Size,0>::Value };
			return Mat.template Access<Row,Col>();
		}
};
template <int M, int N>
struct inverse_Unrolled_R {
	template <int Size>
		static INLINE void compute(SquareMatrix<Size>& res, const SquareMatrix<Size>& Mat,const reel& deter) {
			enum { Col = Size - N };
			enum { Row = Size - M };
			enum { Sign = (((Col+Row)%2)==0) ? 1 : -1 };
			typedef IndexList<Col,Row> IndexCur;
			res.template Access<Row,Col>() = Sign * det_Unrolled<IndexCur,Size-1,Size-1,Size-1>::compute(Mat) / deter;
			inverse_Unrolled_R<M,N-1>::compute(res,Mat,deter);
		}
	template <int Size>
		static INLINE void compute(SymMatrix<Size>& res, const SymMatrix<Size>& Mat,const reel& deter) {
			enum { Col = Size - N };
			enum { Row = Size - M };
			enum { Sign = (((Col+Row)%2)==0) ? 1 : -1 };
			typedef IndexList<Col,Row> IndexCur;
			res.template Access<Row,Col>() = Sign * det_Unrolled<IndexCur,Size-1,Size-1,Size-1>::compute(Mat) / deter;
			inverse_Unrolled_R<M,N-1>::compute(res,Mat,deter);
		}
};
template <int M>
struct inverse_Unrolled_R<M,1> {
	template <int Size>
		static INLINE void compute(SquareMatrix<Size>& res, const SquareMatrix<Size>& Mat,const reel& deter) {
			enum { Col = Size - 1 };
			enum { Row = Size - M };
			enum { Sign = (((Col+Row)%2)==0) ? 1 : -1 };
			typedef IndexList<Col,Row> IndexCur;
			res.template Access<Row,Col>() = Sign * det_Unrolled<IndexCur,Size-1,Size-1,Size-1>::compute(Mat) / deter;
		}
	template <int Size>
		static INLINE void compute(SymMatrix<Size>& res, const SymMatrix<Size>& Mat,const reel& deter) {
			enum { Col = Size - 1 };
			enum { Row = Size - M };
			enum { Sign = (((Col+Row)%2)==0) ? 1 : -1 };
			typedef IndexList<Col,Row> IndexCur;
			res.template Access<Row,Col>() = Sign * det_Unrolled<IndexCur,Size-1,Size-1,Size-1>::compute(Mat) / deter;
		}
};
template <int M>
struct inverse_Unrolled {
	template <int Size>
		static INLINE void compute(SquareMatrix<Size>& res, const SquareMatrix<Size>& Mat,const reel& deter) {
			inverse_Unrolled_R<M,Size>::compute(res,Mat,deter);
			inverse_Unrolled<M-1>::compute(res,Mat,deter);
		}
	template <int Size>
		static INLINE void compute(SymMatrix<Size>& res, const SymMatrix<Size>& Mat,const reel& deter) {
			inverse_Unrolled_R<M,M>::compute(res,Mat,deter);
			inverse_Unrolled<M-1>::compute(res,Mat,deter);
		}
};
template <>
struct inverse_Unrolled<1> {
	template <int Size>
		static INLINE void compute(SquareMatrix<Size>& res, const SquareMatrix<Size>& Mat,const reel& deter) {
			inverse_Unrolled_R<1,Size>::compute(res,Mat,deter);
		}
	template <int Size>
		static INLINE void compute(SymMatrix<Size>& res, const SymMatrix<Size>& Mat,const reel& deter) {
			inverse_Unrolled_R<1,1>::compute(res,Mat,deter);
		}
};
template <int M>
struct trace_Unrolled {
	template <int Size>
		static INLINE reel compute(const SquareMatrix<Size>&Mat){
			return Mat.template Access<Size-M,Size-M>()+trace_Unrolled<M-1>::compute(Mat);
		}
	template <int Size>
		static INLINE reel compute(const SymMatrix<Size>&Mat){
			return Mat.template Access<Size-M,Size-M>()+trace_Unrolled<M-1>::compute(Mat);
		}
};
template <>
struct trace_Unrolled<1> {
	template <int Size>
		static INLINE reel compute(const SquareMatrix<Size>&Mat){
			return Mat.template Access<Size-1,Size-1>();
		}
	template <int Size>
		static INLINE reel compute(const SymMatrix<Size>&Mat){
			return Mat.template Access<Size-1,Size-1>();
		}
};
template <int M>
struct addDiag_Unrolled {
	template <int Size>
		static INLINE void compute(SquareMatrix<Size>&Mat,const reel& Value){
			Mat.template Access<Size-M,Size-M>() += Value;
			addDiag_Unrolled<M-1>::compute(Mat,Value);
		}
	template <int Size>
		static INLINE void compute(SymMatrix<Size>&Mat,const reel& Value){
			Mat.template Access<Size-M,Size-M>() += Value;
			addDiag_Unrolled<M-1>::compute(Mat,Value);
		}
};
template <>
struct addDiag_Unrolled<1> {
	template <int Size>
		static INLINE void compute(SquareMatrix<Size>&Mat,const reel& Value){
			Mat.template Access<Size-1,Size-1>() += Value;
		}
	template <int Size>
		static INLINE void compute(SymMatrix<Size>&Mat,const reel& Value){
			Mat.template Access<Size-1,Size-1>() += Value;
		}
};
enum Operations {
	Op_Plus,
	Op_Minus,
	Op_Prod,
	Op_Div,
	Op_Aff,
	Op_Pre_Minus,
	Op_Sqrt,
	Op_Oppos
};
template <int Row, int Col, Operations Op>
struct OperationX {
	template <class T TPS_START_GCC(0)>
	struct LocalAccess {
		static INLINE const reel& get(const T& Mat) {
			return Mat.template Access<Row,Col>();
		}
		static INLINE reel& get(T& Mat) {
			return Mat.template Access<Row,Col>();
		}
	};
	template <TPS_END_GCC(0)>
	struct LocalAccess < reel TPS_GCC(0) > {
		static INLINE const reel& get(const reel& Mat) {
			return Mat;
		}
	};
	template <Operations _Op TPS_START_GCC(1)>
	struct _Operation {};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Plus TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			res += right;
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Minus TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			res -= right;
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Prod TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			res *= right;
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Div TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			assert(right);
			res /= right;
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Aff TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			res = right;
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Pre_Minus TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			res = right - res;
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Sqrt TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			assert(right>=0);
			res = ::sqrt(right);
		}
	};
	template <TPS_END_GCC(1)>
	struct _Operation< Op_Oppos TPS_GCC(1) > {
		static INLINE void compute( reel& res, const reel& right) {
			assert(right>=0);
			res = -right;
		}
	};
	template <class T1, class T2>
		static INLINE void compute( T1& res, const T2& Mat) {
			_Operation < Op >::compute(LocalAccess<T1>::get(res),LocalAccess<T2>::get(Mat));
		}
};
template <int M, int N>
struct operation_Unrolled_R {
	template <class T1, class T2, Operations Op>
	struct Operation {
		static INLINE void compute(T1& res, const T2& Mat) {
			enum { Col = T1::COL - N };
			enum { Row = T1::ROW - M };
			OperationX<Row,Col,Op>::compute(res,Mat);
			operation_Unrolled_R<M,N-1>::template Operation<T1,T2,Op>::compute(res,Mat);
		}
	};
};
template <int M>
struct operation_Unrolled_R<M,1> {
	template <class T1, class T2, Operations Op>
	struct Operation {
		static INLINE void compute(T1& res, const T2& Mat) {
			enum { Col = T1::COL - 1 };
			enum { Row = T1::ROW - M };
			OperationX<Row,Col,Op>::compute(res,Mat);
		}
	};
};
template <int M>
struct operation_Unrolled {
	template <class T1, class T2, Operations Op>
	struct Operation {
		static INLINE void compute(T1& res, const T2& Mat) {
			operation_Unrolled_R<M,T1::COL>::template Operation<T1,T2,Op>::compute(res,Mat);
			operation_Unrolled<M-1>::template Operation<T1,T2,Op>::compute(res,Mat);
		}
	};
	template <int Size,class T2, Operations Op>
	struct Operation <SymMatrix<Size>,T2,Op> {
		static INLINE void compute(SymMatrix<Size>& res, const T2& Mat) {
			operation_Unrolled_R<M,M>::template Operation<SymMatrix<Size>,T2,Op>::compute(res,Mat);
			operation_Unrolled<M-1>::template Operation<SymMatrix<Size>,T2,Op>::compute(res,Mat);
		}
	};
};
template <>
struct operation_Unrolled<1> {
	template <class T1, class T2, Operations Op>
	struct Operation {
		static INLINE void compute(T1& res, const T2& Mat) {
			operation_Unrolled_R<1,T1::COL>::template Operation<T1,T2,Op>::compute(res,Mat);
		}
	};
	template <int Size,class T2, Operations Op>
	struct Operation <SymMatrix<Size>,T2,Op> {
		static INLINE void compute(SymMatrix<Size>& res, const T2& Mat) {
			operation_Unrolled_R<1,1>::template Operation<SymMatrix<Size>,T2,Op>::compute(res,Mat);
		}
	};
};
template <int M, int N>
struct scalar_product_Unrolled_R {
	template <class T1, class T2>
	struct Operation {
		static INLINE reel compute(const T1& M1, const T2& M2) {
			enum { Col = T1::COL - N };
			enum { Row = T1::ROW - M };
			return M1.template Access<Row,Col>()*M2.template Access<Row,Col>()
				+ scalar_product_Unrolled_R<M,N-1>::template Operation<T1,T2>::compute(M1,M2);
		}
	};
	template <int Size>
	struct Operation < SymMatrix<Size>, SymMatrix<Size> > {
		static INLINE reel compute(const SymMatrix<Size>& M1, const SymMatrix<Size>& M2) {
			enum { Col = SymMatrix<Size>::COL - N };
			enum { Row = SymMatrix<Size>::ROW - M };
			enum { Coef = Col == Row ? 1 : 2 };
			return Coef*M1.template Access<Row,Col>()*M2.template Access<Row,Col>()
				+ scalar_product_Unrolled_R<M,N-1>::template Operation<SymMatrix<Size>, SymMatrix<Size> >::compute(M1,M2);
		}
	};
};
template <int M>
struct scalar_product_Unrolled_R<M,1> {
	template <class T1, class T2>
	struct Operation {
		static INLINE reel  compute(const T1& M1, const T2& M2) {
			enum { Col = T1::COL - 1 };
			enum { Row = T1::ROW - M };
			return M1.template Access<Row,Col>()*M2.template Access<Row,Col>();
		}
	};
	template <int Size>
	struct Operation < SymMatrix<Size>, SymMatrix<Size> > {
		static INLINE reel compute(const SymMatrix<Size>& M1, const SymMatrix<Size>& M2) {
			enum { Col = SymMatrix<Size>::COL - 1 };
			enum { Row = SymMatrix<Size>::ROW - M };
			enum { Coef = Col == Row ? 1 : 2 };
			return Coef*M1.template Access<Row,Col>()*M2.template Access<Row,Col>();
		}
	};
};
template <int M>
struct scalar_product_Unrolled {
	template <class T1, class T2>
	struct Operation {
		static INLINE reel compute(const T1& M1, const T2& M2) {
			return scalar_product_Unrolled_R<M,T1::COL>::template Operation<T1,T2>::compute(M1,M2)
				+ scalar_product_Unrolled<M-1>::template Operation<T1,T2>::compute(M1,M2);
		}
	};
	template <int Size>
	struct Operation <SymMatrix<Size>,SymMatrix<Size> > {
		static INLINE reel compute(const SymMatrix<Size>& M1, const SymMatrix<Size>& M2) {
			return scalar_product_Unrolled_R<M,M>::template Operation<SymMatrix<Size>,SymMatrix<Size> >::compute(M1,M2)
				+ scalar_product_Unrolled<M-1>::template Operation<SymMatrix<Size>,SymMatrix<Size> >::compute(M1,M2);
		}
	};
};
template <>
struct scalar_product_Unrolled<1> {
	template <class T1, class T2>
	struct Operation {
		static INLINE reel compute(const T1& M1, const T2& M2) {
			return scalar_product_Unrolled_R<1,T1::COL>::template Operation<T1,T2>::compute(M1,M2);
		}
	};
	template <int Size>
	struct Operation <SymMatrix<Size>,SymMatrix<Size> > {
		static INLINE reel compute(const SymMatrix<Size>& M1, const SymMatrix<Size>& M2) {
			return scalar_product_Unrolled_R<1,1>::template Operation<SymMatrix<Size>,SymMatrix<Size> >::compute(M1,M2);
		}
	};
};
template <int Row, int Col, int P>
struct matrix_product_Unrolled_P {
	template <class T1, class T2>
	static INLINE reel compute(const T1& M1, const T2& M2) {
		enum { Index = T2::ROW - P };
		return M1.template Access<Row,Index>()*M2.template Access<Index,Col>() + 
			matrix_product_Unrolled_P<Row,Col,P-1>::compute(M1,M2);
	}
};
template <int Row, int Col>
struct matrix_product_Unrolled_P<Row,Col,1> {
	template <class T1, class T2>
	static INLINE reel compute(const T1& M1, const T2& M2) {
		enum { Index = T2::ROW - 1 };
		return M1.template Access<Row,Index>()*M2.template Access<Index,Col>();
	}
};
template <int M, int N>
struct matrix_product_Unrolled_R {
	template <class T, class T1, class T2>
	static INLINE void compute(T& res, const T1& M1, const T2& M2) {
		enum { Col = T::COL - N };
		enum { Row = T::ROW - M };
		res.template Access<Row,Col>() = matrix_product_Unrolled_P<Row,Col,T2::ROW>::compute(M1,M2);
		matrix_product_Unrolled_R<M,N-1>::compute(res,M1,M2);
	}
};
template <int M>
struct matrix_product_Unrolled_R<M,1> {
	template <class T, class T1, class T2>
	static INLINE void compute(T& res, const T1& M1, const T2& M2) {
		enum { Col = T::COL - 1 };
		enum { Row = T::ROW - M };
		res.template Access<Row,Col>() = matrix_product_Unrolled_P<Row,Col,T2::ROW>::compute(M1,M2);
	}
};
template <int M>
struct matrix_product_Unrolled {
	template <class T, class T1, class T2>
	struct Operation {
		static INLINE void compute(T& res, const T1& M1, const T2& M2) {
			matrix_product_Unrolled_R<M,T::COL>::compute(res,M1,M2);
			matrix_product_Unrolled<M-1>::template Operation<T,T1,T2>::compute(res,M1,M2);
		}
	};
	template <int Size, class T1, class T2>
	struct Operation <SymMatrix<Size>,T1,T2> {
		static INLINE void compute(SymMatrix<Size>& res, const T1& M1, const T2& M2) {
			matrix_product_Unrolled_R<M,M>::compute(res,M1,M2);
			matrix_product_Unrolled<M-1>::template Operation<SymMatrix<Size>,T1,T2>::compute(res,M1,M2);
		}
	};
};
template <>
struct matrix_product_Unrolled<1> {
	template <class T, class T1, class T2>
	struct Operation {
		static INLINE void compute(T& res, const T1& M1, const T2& M2) {
			matrix_product_Unrolled_R<1,T::COL>::compute(res,M1,M2);
		}
	};
	template <int Size, class T1, class T2>
	struct Operation <SymMatrix<Size>,T1,T2> {
		static INLINE void compute(SymMatrix<Size>& res, const T1& M1, const T2& M2) {
			matrix_product_Unrolled_R<1,1>::compute(res,M1,M2);
		}
	};
};
template <int M, int N>
struct matrix_trans_Unrolled_R {
	template <class T1, class T2>
	static INLINE void compute(T1& M1, const T2& M2) {
		enum { Col = T1::COL - N };
		enum { Row = T1::ROW - M };
		M1.template Access<Row,Col>() = M2.template Access<Col,Row>();
		matrix_trans_Unrolled_R<M,N-1>::compute(M1,M2);
	}
};
template <int M>
struct matrix_trans_Unrolled_R<M,1> {
	template <class T1, class T2>
	static INLINE void compute(T1& M1, const T2& M2) {
		enum { Col = T1::COL - 1 };
		enum { Row = T1::ROW - M };
		M1.template Access<Row,Col>() = M2.template Access<Col,Row>();
	}
};
template <int M>
struct matrix_trans_Unrolled {
	template <class T1, class T2>
	static INLINE void compute(T1& M1, const T2& M2) {
		matrix_trans_Unrolled_R<M,T1::COL>::compute(M1,M2);
		matrix_trans_Unrolled<M-1>::compute(M1,M2);
	}
};
template <>
struct matrix_trans_Unrolled<1> {
	template <class T1, class T2>
	static INLINE void compute(T1& M1, const T2& M2) {
		matrix_trans_Unrolled_R<1,T1::COL>::compute(M1,M2);
	}
};
NAMESPACE_END
#endif // _MISC_TEMPLATE_H
